home *** CD-ROM | disk | FTP | other *** search
/ Delphi Informant Complete 1995 - 2000 / Delphi Informant Complete 1995 to 2000.iso / Delphi Informant Magazine Complete Works SOURCE CODE 1998.rar / 1998 / May / di9805bm / Unit1.pas < prev   
Pascal/Delphi Source File  |  1997-11-25  |  1KB  |  59 lines

  1. unit Unit1;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   Db, DBTables, StdCtrls, Buttons, Mask;
  8.  
  9. type
  10.   TForm_AS400Command = class(TForm)
  11.     Edit_AS400Cmd: TEdit;
  12.     Label1: TLabel;
  13.     Button_SubCmd: TButton;
  14.     Query_AS400Cmd: TQuery;
  15.     procedure Button_SubCmdClick(Sender: TObject);
  16.   private
  17.     { Private declarations }
  18.   public
  19.     { Public declarations }
  20.   end;
  21.  
  22. Const
  23.   QUOTE = '''';
  24. var
  25.   Form_AS400Command: TForm_AS400Command;
  26.  
  27. implementation
  28.  
  29. {$R *.DFM}
  30.  
  31. procedure TForm_AS400Command.Button_SubCmdClick(Sender: TObject);
  32. Var
  33.    AS400Cmd      :String;
  34.    CmdLen        :String;
  35.    ZeroFill      :Integer;
  36.    i             :Integer;
  37.    ParamTwo      :String;
  38. begin
  39.     Query_AS400CMD.Close;
  40.  
  41.     CmdLen      := IntToStr(Length(Edit_AS400Cmd.Text));
  42.     ZeroFill    := 10 - Length(CmdLen);
  43.     ParamTwo    := '';
  44.     For i := 1 to ZeroFill Do begin
  45.       ParamTwo := ParamTwo + '0';
  46.     End;
  47.     ParamTwo    := ParamTwo + CmdLen + '.00000';
  48.     AS400Cmd    := 'CALL QSYS.QCMDEXC(' + QUOTE + Trim(Edit_AS400Cmd.Text) + QUOTE + ',' + ParamTwo + ')';
  49.  
  50.     Query_AS400Cmd.SQL.Clear;
  51.     Query_AS400CMD.SQL.Add(AS400Cmd);
  52.  
  53.     Query_AS400CMD.ExecSQL;
  54. {CALL QSYS.QCMDEXC('SNDMSG MSG(DELPHI) TOUSR(GBMACDON)',0000000034.00000)}
  55. {OVRDBF FILE(FILE1) TOFILE(SAMELIB/FILE1) MBR(NEWMBR) }
  56. end;
  57.  
  58. end.
  59.